drop database OnlineMobileRecharge
go
use OnlineMobileRecharge

go

create table AdminAccount
(
	_username nvarchar(30),
	_password nvarchar(30),
)

go

create table TopUp
(
	id_TU int identity,
	_duration int,
	_denominations float,
	_discount int,
	_total float
)

go

create table SpecialRecharge
(
	id_SP int identity,
	_packageName nvarchar(30),
	_durationDate int,
	_discount int,
	_denominations float,
	_description nvarchar(100)
)

go

create table UserAccount
(
	id_UA int identity primary key,
	_username nvarchar(11) unique,
	_password nvarchar(30),
	_serviceType nvarchar(30),
	_createdDate datetime
)

go

create table UserDetails
(
	id_UD int identity,
	_name nvarchar(30),
	_dateOfBirth datetime,
	_gender nvarchar(6),
	_address nvarchar(100),
	_email nvarchar(100)
	constraint FK_UserDetails foreign key (id_UD) references UserAccount(id_UA)
)

go

create table BillTopUp
(
	id_BTU int identity,
	id_UA int,
	_billID int,
	_billStatus nvarchar(30),
	_createdDate datetime,
	_paymentDate datetime
	constraint FK_BillTopUp foreign key (id_UA) references UserAccount(id_UA)
)

go

create table BillSpecialRecharge
(
	id_BSP int identity,
	id_UA int,
	_billID int,
	_billStatus nvarchar(30),
	_createdDate datetime,
	_paymentDate datetime
	constraint FK_BillSpecial foreign key (id_UA) references UserAccount(id_UA)
)

go

create table FeedBack
(
	id_FB int,
	_feedBack nvarchar(1000),
	_createdDate datetime,
	_status nvarchar(30)
	constraint FK_FeedBack foreign key (id_FB) references UserAccount(id_UA)
)

go

create table GuestFeedBack
(
	id_FB int identity,
	_feedBack nvarchar(1000),
	_email nvarchar(100),
	_createdDate nvarchar(30),
	_status nvarchar(30)
)